﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.Entity;
using School.Entities;
using School.Accounting;

namespace School.Pages.Accounting
{
    public partial class ExpenseDelete : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            long id;
            bool result = true;
            
            if(long.TryParse(Request.QueryString["Id"], out id))
            {
                result = Expense.Delete(id);
            }

            if (result)
                Response.Redirect("Expenses.aspx");
            else
                LblError.Text = "لا يمكن حذف هذا المصروف لوجود إيصالات لم ترحل خاصة به";
        }
    }
}